home *** CD-ROM | disk | FTP | other *** search
- Path: fido.asd.sgi.com!austern
- From: "john (j.d.) hickin" <hickin@bnr.ca>
- Newsgroups: comp.std.c++
- Subject: Re: auto_ptr again
- Date: 23 Jan 1996 10:22:44 PST
- Organization: Bell-Northern Research
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <4e2stq$128@bmtlh10.bnr.ca>
- References: <Pine.A32.3.91.960122095620.24366A-100000@zorglub.cae.ca>
- NNTP-Posting-Host: isolde.mti.sgi.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Original-Date: Tue, 23 Jan 1996 14:55:54 +0000
- Content-Identifier: Re: auto_ptr ...
- X-Mailer: Mozilla 1.1 (X11; I; HP-UX A.09.05 9000/715)
- X-Url: news:Pine.A32.3.91.960122095620.24366A-100000@zorglub.cae.ca
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMQUnk0y4NqrwXLNJAQHn7wH+O2kBomuJ4xJBOoT8IsNAmEqLLH3+UVwe
- of/HBJMjXuh6kzoDwIoQdBhkfmEq+WbQ9sLJ6SLw4oC9qNhVcjsa1Q==
- =Za6e
- Originator: austern@isolde.mti.sgi.com
-
- dak wrote:
- [text elided]
- |> Has it even been discussed ? I do find it quite cynical that this exact
- |> choice (temporaries are const) makes it hard to use auto_ptr in return
- |> value (and some other uses too in smart pointer), while most compiler have
- |> a switch to allow non-const temporaries (and thus disabling any protection
- |> from unexpected conversion on function argument that was the original
- |> intent).
-
- Perhaps the assumptions underlying the original decree are no longer valid
- because of the extra control over conversions available in 'standard C++'.
-
- Permit me to open a can of worms...
-
- I can implement a version of auto_ptr that is fully const correct because the
- implementation uses a pointer to a pointer to hold onto the basic resource.
-
- One could, therefore, argue that because a const correct implementation can
- exist that an implementation with the same observables, but with const
- correctness twisted a bit, should be OK. (See note 1 below).
-
- One could also turn this about-face; the net result of banishing the proposed
- hackery being an argument in favour of deep const. I warned you about a can of
- worms!
-
- J.
-
-
- Notes:
- -----
-
- 1. As far as I can see, true const correctness with a pointer-to-pointer
- implementation might require bounding the number of auto_ptr instances.
- The implementation, therefore, would not quite live up to the spec for
- auto_ptr (but in any practical system there will be an upper bound).
-
- --
- John Hickin Bell-Northern Research, Montreal, Quebec
- (514) 765-7924 hickin@bnr.ca
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-